home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!wyse!mikew
- From: mikew@wyse.wyse.com (Mike Wexler)
- Newsgroups: comp.sources.x
- Subject: v02i083: X11 Release 3, Patch6
- Message-ID: <1979@wyse.wyse.com>
- Date: 11 Jan 89 00:01:38 GMT
- Organization: Wyse Technology, San Jose
- Lines: 1833
- Approved: mikew@wyse.com
-
- Submitted-by: jim@expo.lcs.mit.edu (Jim Fulton)
- Posting-number: Volume 2, Issue 83
- Archive-name: x11.3/patch6
-
-
-
- Created on Monday, 9 January 1989
-
- PART 2 of 3
-
-
- Fixes 5, 6, and 7 are part of a single update to the xman program. Together
- they affect the following files:
-
- clients/xman/CHANGES
- clients/xman/README
- clients/xman/ScrollByL.c
- clients/xman/TODO
- clients/xman/buttons.c
- clients/xman/defs.h
- clients/xman/globals.c
- clients/xman/globals.h
- clients/xman/handler.c
- clients/xman/help.c
- clients/xman/main.c
- clients/xman/man.c
- clients/xman/man.h
- clients/xman/menu.c
- clients/xman/misc.c
- clients/xman/pages.c
- clients/xman/search.c
- clients/xman/tkfuncs.c
- clients/xman/version.h
- clients/xman/xman.help
- clients/xman/xman.man
-
- To apply these fixes, concatenate all three files and pipe them to patch -p0
- from the top of your X sources:
-
- % cat fix5 fix6 fix7 | patch -p0
-
-
- The following is fix6 (you will also need fix5 and fix7):
-
-
-
- *** /tmp/,RCSt1a17133 Fri Jan 6 18:56:28 1989
- --- clients/xman/ScrollByL.c Fri Jan 6 18:41:48 1989
- ***************
- *** 1,8 ****
- /*
- * xman - X window system manual page display program.
- *
- ! * $XConsortium: ScrollByL.c,v 1.4 88/10/17 20:21:12 swick Exp $
- ! * $oHeader: ScrollByL.c,v 4.0 88/08/31 22:11:02 kit Exp $
- *
- * Copyright 1987, 1988 Massachusetts Institute of Technology
- *
- --- 1,8 ----
- /*
- * xman - X window system manual page display program.
- *
- ! * $XConsortium: ScrollByL.c,v 1.5 89/01/06 18:41:40 kit Exp $
- ! * $Header: ScrollByL.c,v 1.5 89/01/06 18:41:40 kit Exp $
- *
- * Copyright 1987, 1988 Massachusetts Institute of Technology
- *
- ***************
- *** 21,27 ****
- */
-
- #if ( !defined(lint) && !defined(SABER))
- ! static char rcs_version[] = "$Athena: ScrollByL.c,v 4.0 88/08/31 22:11:02 kit Exp $";
- #endif
-
- /*
- --- 21,27 ----
- */
-
- #if ( !defined(lint) && !defined(SABER))
- ! static char rcs_version[] = "$Athena: ScrollByL.c,v 4.5 88/12/19 13:46:04 kit Exp $";
- #endif
-
- /*
- ***************
- *** 30,36 ****
- * and do it much more like the Viewport widget in the Athena widget set.
- * But this works and time is short, so here it is.
- *
- ! * Chris Peterson 1/30/88
- */
-
- #include <X11/IntrinsicP.h>
- --- 30,41 ----
- * and do it much more like the Viewport widget in the Athena widget set.
- * But this works and time is short, so here it is.
- *
- ! * Chris D. Peterson 1/30/88
- ! *
- ! * I removed all the code for horizontal scrolling here, since is was a crock
- ! * anyway.
- ! *
- ! * Chris D. Peterson 11/13/88
- */
-
- #include <X11/IntrinsicP.h>
- ***************
- *** 59,65 ****
- static XtResource resources[] = {
- {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
- XtOffset(ScrollByLineWidget, scroll_by_line.foreground),
- ! XtRString, "Black"},
- {XtNinnerWidth, XtCWidth, XtRInt, sizeof(int),
- XtOffset(ScrollByLineWidget, scroll_by_line.inner_width),
- XtRString, "100"},
- --- 64,70 ----
- static XtResource resources[] = {
- {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
- XtOffset(ScrollByLineWidget, scroll_by_line.foreground),
- ! XtRString, "XtDefaultForeground"},
- {XtNinnerWidth, XtCWidth, XtRInt, sizeof(int),
- XtOffset(ScrollByLineWidget, scroll_by_line.inner_width),
- XtRString, "100"},
- ***************
- *** 69,83 ****
- {XtNforceBars, XtCBoolean, XtRBoolean, sizeof(Boolean),
- XtOffset(ScrollByLineWidget, scroll_by_line.force_bars),
- XtRString, "FALSE"},
- - {XtNallowHoriz, XtCBoolean, XtRBoolean, sizeof(Boolean),
- - XtOffset(ScrollByLineWidget, scroll_by_line.allow_horiz),
- - XtRString, "FALSE"},
- {XtNallowVert, XtCBoolean, XtRBoolean, sizeof(Boolean),
- XtOffset(ScrollByLineWidget, scroll_by_line.allow_vert),
- XtRString, "FALSE"},
- - {XtNuseBottom, XtCBoolean, XtRBoolean, sizeof(Boolean),
- - XtOffset(ScrollByLineWidget, scroll_by_line.use_bottom),
- - XtRString, "FALSE"},
- {XtNuseRight, XtCBoolean, XtRBoolean, sizeof(Boolean),
- XtOffset(ScrollByLineWidget, scroll_by_line.use_right),
- XtRString, "FALSE"},
- --- 74,82 ----
- ***************
- *** 101,113 ****
- *
- ****************************************************************/
-
- - static void HorizontalThumb();
- static Boolean ScrollVerticalText();
- static void VerticalThumb();
- - static void HorizontalScroll();
- static void VerticalScroll();
- static void Page();
- static void InitializeHook();
- static void Realize();
- static void Resize();
- static void ResetThumb();
- --- 100,111 ----
- *
- ****************************************************************/
-
- static Boolean ScrollVerticalText();
- static void VerticalThumb();
- static void VerticalScroll();
- static void Page();
- static void InitializeHook();
- + static void Initialize();
- static void Realize();
- static void Resize();
- static void ResetThumb();
- ***************
- *** 114,120 ****
- static void Redisplay();
- static void ChildExpose();
- static Boolean SetValues();
- - static int MergeArglists();
- static Boolean Layout();
- static XtGeometryResult GeometryManager();
- static void ChangeManaged();
- --- 112,117 ----
- ***************
- *** 133,139 ****
- /* class_initialize */ NULL,
- /* class_part_init */ NULL,
- /* class_inited */ FALSE,
- ! /* initialize */ NULL,
- /* initialize_hook */ InitializeHook,
- /* realize */ Realize,
- /* actions */ actions,
- --- 130,136 ----
- /* class_initialize */ NULL,
- /* class_part_init */ NULL,
- /* class_inited */ FALSE,
- ! /* initialize */ Initialize,
- /* initialize_hook */ InitializeHook,
- /* realize */ Realize,
- /* actions */ actions,
- ***************
- *** 185,190 ****
- --- 182,189 ----
- /* Function Name: Layout
- * Description: This function lays out the scroll_by_line widget.
- * Arguments: w - the scroll_by_line widget.
- + * key - a boolean: if true then resize the widget to the child
- + * if false the resize children to fit widget.
- * Returns: TRUE if successful.
- */
-
- ***************
- *** 196,219 ****
- ScrollByLineWidget sblw = (ScrollByLineWidget) w;
- Dimension width,height; /* The size that the widget would like to be */
- XtGeometryResult answer; /* the answer from the parent. */
- ! Widget hbar,vbar,child; /* The three children of this
- ! scrolled widget. */
- int vbar_x,vbar_y; /* The locations of the various elements. */
- ! int hbar_x,hbar_y;
- ! int child_x,child_y;
- ! int c_width,c_height;
- Boolean make_bar;
-
- vbar = sblw->composite.children[0];
- ! hbar = sblw->composite.children[1];
- ! child = sblw->composite.children[2];
- height = sblw->core.height;
- width = sblw->core.width;
-
- /* set the initial scroll bar positions. */
-
- ! vbar_x = vbar_y = 0;
- ! hbar_x = hbar_y = 0;
-
- /* Should I allow the vertical scrollbar to be seen */
-
- --- 195,214 ----
- ScrollByLineWidget sblw = (ScrollByLineWidget) w;
- Dimension width,height; /* The size that the widget would like to be */
- XtGeometryResult answer; /* the answer from the parent. */
- ! Widget vbar,child; /* The two children of this scrolled widget. */
- int vbar_x,vbar_y; /* The locations of the various elements. */
- ! int child_x;
- ! int c_width;
- Boolean make_bar;
-
- vbar = sblw->composite.children[0];
- ! child = sblw->composite.children[1];
- height = sblw->core.height;
- width = sblw->core.width;
-
- /* set the initial scroll bar positions. */
-
- ! vbar_x = vbar_y = - vbar->core.border_width;
-
- /* Should I allow the vertical scrollbar to be seen */
-
- ***************
- *** 238,258 ****
- else
- c_width = width - vbar->core.width -2 * vbar->core.border_width;
-
- ! /* Put Scrollbar on right side if scrolled window? */
-
- if (sblw->scroll_by_line.use_right) {
- vbar_x = width - vbar->core.width - 2 * vbar->core.border_width;
- child_x = 0;
- }
- ! else {
- ! child_x = vbar->core.width + 2 * vbar->core.border_width;
- ! vbar_x = 0;
- ! }
- }
- else {
- /* Make the scroll bar dissappear, note how scroll bar is always there,
- sometimes it is just that we cannot see them. */
- ! vbar_x = - vbar->core.width - 10;
- child_x = 0;
- if (key)
- width = child->core.width;
- --- 233,251 ----
- else
- c_width = width - vbar->core.width -2 * vbar->core.border_width;
-
- ! /* Put Scrollbar on right side if scrolled window? */
-
- if (sblw->scroll_by_line.use_right) {
- vbar_x = width - vbar->core.width - 2 * vbar->core.border_width;
- child_x = 0;
- }
- ! else
- ! child_x = vbar->core.width + vbar->core.border_width;
- }
- else {
- /* Make the scroll bar dissappear, note how scroll bar is always there,
- sometimes it is just that we cannot see them. */
- ! vbar_x = - vbar->core.width - 2 * vbar->core.border_width - 10;
- child_x = 0;
- if (key)
- width = child->core.width;
- ***************
- *** 260,356 ****
- c_width = width;
- }
-
- ! /* set the horizontal bar position. */
-
- ! /* should we allow the horiz. scroll bar. */
-
- ! if (sblw->scroll_by_line.allow_horiz && (child->core.width >= width ||
- ! sblw->scroll_by_line.force_bars)) {
- ! if (key)
- ! height = child->core.height + hbar->core.height +
- ! 2 * hbar->core.border_width;
- ! else
- ! c_height = height - hbar->core.height - 2 * hbar->core.border_width;
-
- ! hbar_x = child_x;
-
- ! /* Should we put the scroll bar on the bottom?? */
-
- ! if (sblw->scroll_by_line.use_bottom) {
- ! hbar_y = height - hbar->core.height - 2 * hbar->core.border_width;
- ! child_y = 0;
- ! }
- ! else {
- ! child_y = hbar->core.height + 2 * hbar->core.border_width;
- ! vbar_y = child_y;
- ! hbar_y = 0;
- ! }
- ! }
- ! else {
- ! /* make this scroll bar disappear. */
- ! hbar_y = - hbar->core.height - 10;
- ! child_y = 0;
- ! if (key)
- ! height = child->core.height;
- ! else
- ! c_height = height;
- ! }
-
- - /* if the windows are realized we have to move them. */
- -
- - if (XtIsRealized( (Widget) sblw)) {
- - XtMoveWidget(hbar,hbar_x,hbar_y);
- - XtMoveWidget(vbar,vbar_x,vbar_y);
- - XtMoveWidget(child,child_x,child_y);
- -
- - /* resize the children to be the correct height or width. */
- -
- - XtResizeWidget(vbar,vbar->core.width,height -
- - 2 * vbar->core.border_width - vbar_y,
- - vbar->core.border_width);
- -
- - XtResizeWidget(hbar,width - hbar_x -
- - 2 * hbar->core.border_width,
- - hbar->core.height,hbar->core.border_width);
- -
- - if (!key)
- - XtResizeWidget(child, (Cardinal) c_width, (Cardinal) c_height,
- - child->core.border_width);
- -
- - }
- - /*
- - * If they are not realized we do not need to move them then just set their
- - * core values, this saves a bit of time.
- - */
- - else {
- - hbar->core.x = hbar_x;
- - hbar->core.y = hbar_y;
- - vbar->core.x = vbar_x;
- - vbar->core.y = vbar_y;
- - child->core.x = child_x;
- - child->core.y = child_y;
- -
- - /* resize the scrollbars to be the correct height or width. */
- -
- - XtResizeWidget(vbar,vbar->core.width,height -
- - 2 * vbar->core.border_width - vbar_y,
- - vbar->core.border_width);
- -
- - XtResizeWidget(hbar,width - hbar_x -
- - 2 * hbar->core.border_width,
- - hbar->core.height,hbar->core.border_width);
- -
- - if (!key) {
- - child->core.width = c_width;
- - child->core.height = c_height;
- - }
- - }
- -
- - height = height;
- - width = width;
- -
- - /* set the thumb size to be correct. */
- -
- ResetThumb( (Widget) sblw);
-
- answer = XtMakeResizeRequest( (Widget) sblw, width, height, &width, &height);
- --- 253,273 ----
- c_width = width;
- }
-
- ! /* Move child and v_bar to correct location. */
-
- ! XtMoveWidget(vbar, vbar_x, vbar_y);
- ! XtMoveWidget(child, child_x, 0);
-
- ! /* resize the children to be the correct height or width. */
-
- ! XtResizeWidget(vbar, vbar->core.width, height, vbar->core.border_width);
-
- ! if (!key)
- ! XtResizeWidget(child, (Cardinal) (c_width - 20), (Cardinal) height,
- ! child->core.border_width);
-
- ! /* set the thumb size to be correct. */
-
- ResetThumb( (Widget) sblw);
-
- answer = XtMakeResizeRequest( (Widget) sblw, width, height, &width, &height);
- ***************
- *** 378,388 ****
- {
- float shown;
- ScrollByLineWidget sblw = (ScrollByLineWidget) w;
- ! Widget child,vbar,hbar;
-
- vbar = sblw->composite.children[0];
- ! hbar = sblw->composite.children[1];
- ! child = sblw->composite.children[2];
-
- /* vertical */
-
- --- 295,304 ----
- {
- float shown;
- ScrollByLineWidget sblw = (ScrollByLineWidget) w;
- ! Widget child,vbar;
-
- vbar = sblw->composite.children[0];
- ! child = sblw->composite.children[1];
-
- /* vertical */
-
- ***************
- *** 392,409 ****
- shown = 1.0;
-
- XtScrollBarSetThumb( vbar, (float) -1, shown );
- -
- - /* horizontal */
- -
- - shown = (float) child->core.width / (float) child->core.width;
- - XtScrollBarSetThumb( hbar, (float) -1, shown );
- }
-
- /*
- *
- * Geometry Manager - If the height of width is changed then try a new layout.
- ! * else dissallow the requwest.
- ! *
- */
-
- /*ARGSUSED*/
- --- 308,320 ----
- shown = 1.0;
-
- XtScrollBarSetThumb( vbar, (float) -1, shown );
- }
-
- /*
- *
- * Geometry Manager - If the height of width is changed then try a new layout.
- ! * else dissallow the requwest.
- ! *
- */
-
- /*ARGSUSED*/
- ***************
- *** 440,446 ****
- * then I call the redisplay routine.
- */
-
- ! Redisplay(w->core.parent,event);
- } /* ChildExpose */
-
- /*
- --- 351,359 ----
- * then I call the redisplay routine.
- */
-
- ! if ((event->type == Expose) || (event->type == GraphicsExpose))
- ! Redisplay(w->core.parent, event, NULL);
- !
- } /* ChildExpose */
-
- /*
- ***************
- *** 448,456 ****
- */
-
- /* ARGSUSED */
- ! static void Redisplay(w, event)
- Widget w;
- XEvent *event;
- {
- ScrollByLineWidget sblw = (ScrollByLineWidget) w;
-
- --- 361,370 ----
- */
-
- /* ARGSUSED */
- ! static void Redisplay(w, event, region)
- Widget w;
- XEvent *event;
- + Region region;
- {
- ScrollByLineWidget sblw = (ScrollByLineWidget) w;
-
- ***************
- *** 543,549 ****
- * of scrolling has been turned off.
- */
-
- ! if (vbar->core.x < 0)
- return;
-
- switch ( direction ) {
- --- 457,463 ----
- * of scrolling has been turned off.
- */
-
- ! if (vbar->core.x < - vbar->core.border_width)
- return;
-
- switch ( direction ) {
- ***************
- *** 555,561 ****
- case 'b':
- case 'B':
- /* move one page backward */
- ! VerticalScroll(vbar,NULL, (int) - vbar->core.height);
- break;
- case 'L':
- case 'l':
- --- 469,475 ----
- case 'b':
- case 'B':
- /* move one page backward */
- ! VerticalScroll(vbar,NULL, - (int) vbar->core.height);
- break;
- case 'L':
- case 'l':
- ***************
- *** 595,602 ****
- ScrollByLineStruct sblw_struct;
- Boolean move_thumb = FALSE;
-
- - child = sblw->composite.children[2];
- vbar = sblw->composite.children[0];
-
- num_lines = child->core.height / sblw->scroll_by_line.font_height;
-
- --- 509,516 ----
- ScrollByLineStruct sblw_struct;
- Boolean move_thumb = FALSE;
-
- vbar = sblw->composite.children[0];
- + child = sblw->composite.children[1];
-
- num_lines = child->core.height / sblw->scroll_by_line.font_height;
-
- ***************
- *** 613,618 ****
- --- 527,534 ----
- max_lines = sblw->scroll_by_line.lines -
- child->core.height / sblw->scroll_by_line.font_height;
-
- + if (max_lines < 0) max_lines = 0;
- +
- if ( new_line > max_lines ) {
- new_line = max_lines;
- move_thumb = TRUE;
- ***************
- *** 787,973 ****
-
- }
-
- ! /*
- ! * I have not thought out the horizontal scrolling yet, I am not sure what
- ! * should be done here. This code is questionable.
- ! */
- !
- !
- ! /* Function Name: HorizontalThumb
- ! * Description: This function moves the postition of the interior window
- ! * as the vertical scroll bar is moved.
- ! * Arguments: w - the scrollbar widget.
- ! * junk - not used.
- ! * percent - the position of the scrollbar.
- ! * Returns: none.
- ! */
- !
- ! static void
- ! HorizontalThumb(w,junk,percent)
- ! Widget w;
- ! caddr_t junk;
- ! float *percent;
- {
- - int x, y;
- - Widget child,vbar;
- - ScrollByLineWidget sblw = (ScrollByLineWidget) w->core.parent;
- -
- - /* reposition the client window (child[2]) */
- -
- - vbar = sblw->composite.children[0];
- - child = sblw->composite.children[2];
- -
- - x = (int) ( (0.0 - (*percent)) * ((float) child->core.width));
- - y = child->core.y;
- -
- - /*
- - * if there is a vertical scrollbar and it is on the left then
- - * allow room for it .
- - */
- -
- - if (vbar->core.x == 0)
- - x += vbar->core.width + 2 * vbar->core.border_width;
- -
- - XtMoveWidget(child,x,y);
- - }
- -
- - /* Function Name: HorizontalScroll
- - * Description: This function moves the postition of the interior window
- - * as the horizontal scroll bar is moved.
- - * Arguments: w - the scrollbar widget.
- - * junk - not used.
- - * pos - the position of the cursor.
- - * Returns: none.
- - */
- -
- - static void
- - HorizontalScroll(w,junk,pos)
- - Widget w;
- - caddr_t junk;
- - int pos;
- - {
- - int x, y, min_x;
- - float location;
- - Widget child,vbar,hbar;
- - ScrollByLineWidget sblw = (ScrollByLineWidget) w->core.parent;
- -
- - /* reposition the client window (child[2]) */
- -
- - vbar = sblw->composite.children[0];
- - hbar = sblw->composite.children[1];
- - child = sblw->composite.children[2];
- -
- - x = child->core.x - pos;
- - y = child->core.y;
- -
- - /*
- - * Keep us in bounds.
- - */
- -
- - if ( x > 0 ) x = 0;
- - min_x = - (child->core.width - hbar->core.width -
- - 2 * vbar->core.border_width);
- -
- - if (vbar->core.y > 0) /* vertical scrollbar is on right.*/
- - min_x -= vbar->core.width + 2 * vbar->core.border_width;
- -
- - if ( x < min_x ) x = min_x;
- -
- - /* reposition the thumb */
- -
- - location = 0.0 - (float) y / (float) child->core.width;
- - XtScrollBarSetThumb( hbar, location , (float) -1 );
- -
- - /*
- - * if there is a vertical scrollbar and it is on the left then
- - * allow room for it .
- - */
- -
- - if (vbar->core.x == 0)
- - y += vbar->core.width + 2 * vbar->core.border_width;
- -
- - XtMoveWidget(child,x,y); /* he's my child so I can move him. */
- - }
- -
- - static void InitializeHook(new, args, num_args)
- - ScrollByLineWidget new;
- - ArgList args;
- - Cardinal *num_args;
- - {
- ScrollByLineWidget sblw = (ScrollByLineWidget) new;
- - Widget window; /* Window widget. */
- - Arg arglist[50]; /* Must be large enough for the
- - arglist from the scrolled widget to
- - be added to it. */
- - Cardinal scrollbar_num; /* the number of scrollbar args. */
- - Cardinal window_num; /* the number of window args. */
-
- ! static XtCallbackRec scrollcallback[] = { /* The scroll callback function. */
- ! { NULL, NULL },
- ! { NULL, NULL },
- ! };
- ! static XtCallbackRec thumbcallback[] = { /* The thumb callback function. */
- ! { NULL, NULL },
- ! { NULL, NULL },
- ! };
-
- - sblw->scroll_by_line.line_pointer = 0; /* initial point to line 0. */
- -
- if (sblw->core.height <= 0)
- sblw->core.height = DEFAULT_HEIGHT;
- if (sblw->core.width <= 0)
- sblw->core.width = DEFAULT_WIDTH;
-
- ! scrollbar_num = 0;
- ! XtSetArg(arglist[scrollbar_num], XtNheight, 10); /* changed in layout. */
- ! scrollbar_num++;
- ! XtSetArg(arglist[scrollbar_num], XtNwidth, 16);
- ! scrollbar_num++;
- ! XtSetArg(arglist[scrollbar_num], XtNorientation, XtorientVertical);
- ! scrollbar_num++;
- ! thumbcallback[0].callback = VerticalThumb;
- ! scrollcallback[0].callback = VerticalScroll;
- ! XtSetArg(arglist[scrollbar_num], XtNjumpProc, thumbcallback);
- ! scrollbar_num++;
- ! XtSetArg(arglist[scrollbar_num], XtNscrollProc, scrollcallback);
- ! scrollbar_num++;
-
- ! /*
- ! * Merge the argument lists so but have the scrollbar arglist take
- ! * control when there is a discrepency this causes us to get the
- ! * correct height and width.
- ! */
-
- - scrollbar_num = MergeArglists(args, *num_args,arglist,scrollbar_num);
- -
- - XtCreateManagedWidget("Vertical Scroll Bar",
- - scrollbarWidgetClass, (Widget) sblw,arglist,scrollbar_num);
- -
- - scrollbar_num = 0;
- - XtSetArg(arglist[scrollbar_num], XtNwidth, 10); /* changed in layout. */
- - scrollbar_num++;
- - XtSetArg(arglist[scrollbar_num], XtNheight, 16);
- - scrollbar_num++;
- - XtSetArg(arglist[scrollbar_num], XtNorientation, XtorientHorizontal);
- - scrollbar_num++;
- - thumbcallback[0].callback = HorizontalThumb;
- - scrollcallback[0].callback = HorizontalScroll;
- - XtSetArg(arglist[scrollbar_num], XtNjumpProc, thumbcallback);
- - scrollbar_num++;
- - XtSetArg(arglist[scrollbar_num], XtNscrollProc, scrollcallback);
- - scrollbar_num++;
- -
- - /*
- - * Merge the argument lists so but have the scrollbar arglist take
- - * control when there is a discrepency this causes us to get the
- - * correct height and width.
- - */
- -
- - scrollbar_num = MergeArglists(args, *num_args,arglist,scrollbar_num);
- -
- - XtCreateManagedWidget("Horizontal Scroll Bar",
- - scrollbarWidgetClass, (Widget) sblw,arglist,scrollbar_num);
- -
- window_num = 0;
- XtSetArg(arglist[window_num], XtNwidth, sblw->scroll_by_line.inner_width);
- window_num++;
- --- 703,739 ----
-
- }
-
- ! static void
- ! Initialize(req, new)
- ! Widget req, new;
- {
- ScrollByLineWidget sblw = (ScrollByLineWidget) new;
-
- ! sblw->scroll_by_line.line_pointer = 0; /* initially point to line 0. */
-
- if (sblw->core.height <= 0)
- sblw->core.height = DEFAULT_HEIGHT;
- if (sblw->core.width <= 0)
- sblw->core.width = DEFAULT_WIDTH;
- + } /* Initialize. */
-
- ! static void
- ! InitializeHook(new, args, num_args)
- ! ScrollByLineWidget new;
- ! ArgList args;
- ! Cardinal *num_args;
- ! {
- ! ScrollByLineWidget sblw = (ScrollByLineWidget) new;
- ! Widget window, s_bar; /* Window widget, and scollbar. */
- ! Arg arglist[10]; /* an arglist. */
- ! ArgList merged_list, XtMergeArgLists(); /* The merged arglist. */
- ! Cardinal window_num, merged_num; /* The number of window args. */
-
- ! s_bar = XtCreateManagedWidget("verticalScrollBar", scrollbarWidgetClass,
- ! (Widget) sblw, args, *num_args);
- ! XtAddCallback(s_bar, XtNjumpProc, VerticalThumb, NULL);
- ! XtAddCallback(s_bar, XtNscrollProc, VerticalScroll, NULL);
-
- window_num = 0;
- XtSetArg(arglist[window_num], XtNwidth, sblw->scroll_by_line.inner_width);
- window_num++;
- ***************
- *** 975,988 ****
- window_num++;
- XtSetArg(arglist[window_num], XtNborderWidth, 0);
- window_num++;
-
- ! window = XtCreateWidget("Window with file",widgetClass,(Widget) sblw,arglist,
- ! window_num);
- XtManageChild(window);
-
- ! /* We want expose events for this window also. */
-
- ! XtAddEventHandler(window, (Cardinal) ExposureMask, FALSE, ChildExpose, NULL);
-
- } /* InitializeHook */
-
- --- 741,764 ----
- window_num++;
- XtSetArg(arglist[window_num], XtNborderWidth, 0);
- window_num++;
- +
- + /*
- + * I hope this will cause my args to override those passed to the SBL widget.
- + */
-
- ! merged_list = XtMergeArgLists(args, *num_args, arglist, window_num);
- ! merged_num = *num_args + window_num;
- !
- ! window = XtCreateWidget("windowWithFile",widgetClass,(Widget) sblw,
- ! merged_list, merged_num);
- XtManageChild(window);
- + XtFree(merged_list); /* done, free it. */
-
- ! /*
- ! * We want expose (and graphic exposuer) events for this window also.
- ! */
-
- ! XtAddEventHandler(window, (Cardinal) ExposureMask, TRUE, ChildExpose, NULL);
-
- } /* InitializeHook */
-
- ***************
- *** 1023,1078 ****
-
- } /* Set Values */
-
- - /* Function Name: MergeArglists
- - * Description: This function merges two arglists.
- - * Arguments: from,num_from - the number and list of args for the source.
- - * to,num_to - the number and list of argument for the
- - * destination.
- - * Returns: new number of argument in to.
- - */
- -
- - /* Note: This function will be very unhappy with you if 'to' is not
- - * large enough to contain 'from', you will end up with pointers
- - * in space.
- - */
- -
- - static int
- - MergeArglists(from,num_from,to,num_to)
- - Arg from[],to[];
- - Cardinal num_from,num_to;
- - {
- - int i,j; /* a counter. */
- -
- - /* When there are two similar values ignore the from value. */
- -
- - i = 0;
- - while ( i < num_from ) {
- - j = 0;
- - while ( j < num_to ) {
- - if ( !strcmp(from[i].name,to[j].name) ) {
- - /* if they are the same then goto next on the from list,
- - i.e. ignore this entry, do not add to to list. */
- - i++;
- - if ( i > num_from)
- - j = num_to + 100;
- - else {
- - j = 0;
- - continue;
- - }
- - }
- - j++;
- - }
- - /* add to to list */
- - if (j < num_to + 100) {
- - to[num_to].value = from[i].value;
- - to[num_to].name = from[i].name;
- - num_to++;
- - i++;
- - }
- - }
- - return(num_to);
- - }
- -
- /* Public Routines. */
-
- /* Function Name: XtScrollByLineWidget()
- --- 799,804 ----
- ***************
- *** 1087,1093 ****
- {
- ScrollByLineWidget sblw = (ScrollByLineWidget) w; /* the sblw widget. */
-
- ! return(sblw->composite.children[2]);
- }
-
- /* Function Name: XtResetScrollByLine
- --- 813,819 ----
- {
- ScrollByLineWidget sblw = (ScrollByLineWidget) w; /* the sblw widget. */
-
- ! return(sblw->composite.children[1]);
- }
-
- /* Function Name: XtResetScrollByLine
- ***************
- *** 1114,1118 ****
- (float) sblw->scroll_by_line.lines;
- XtScrollBarSetThumb( vbar, location , (float) -1 );
-
- ! ResetThumb(w);
- }
- --- 840,844 ----
- (float) sblw->scroll_by_line.lines;
- XtScrollBarSetThumb( vbar, location , (float) -1 );
-
- ! Layout(w, FALSE); /* see if new layout is required. */
- }
- *** /tmp/,RCSt1a17182 Fri Jan 6 18:56:42 1989
- --- clients/xman/handler.c Fri Jan 6 18:42:02 1989
- ***************
- *** 1,7 ****
- /*
- * xman - X window system manual page display program.
- *
- ! * $XConsortium: handler.c,v 1.2 88/09/06 17:47:50 jim Exp $
- *
- * Copyright 1987, 1988 Massachusetts Institute of Technology
- *
- --- 1,7 ----
- /*
- * xman - X window system manual page display program.
- *
- ! * $XConsortium: handler.c,v 1.3 89/01/06 18:42:00 kit Exp $
- *
- * Copyright 1987, 1988 Massachusetts Institute of Technology
- *
- ***************
- *** 20,26 ****
- */
-
- #if ( !defined(lint) && !defined(SABER))
- ! static char rcs_version[] = "$Athena: handler.c,v 4.0 88/08/31 22:11:58 kit Exp $";
- #endif
-
- #include "globals.h"
- --- 20,26 ----
- */
-
- #if ( !defined(lint) && !defined(SABER))
- ! static char rcs_version[] = "$Athena: handler.c,v 4.6 89/01/06 12:17:27 kit Exp $";
- #endif
-
- #include "globals.h"
- ***************
- *** 84,91 ****
- * I did not have a two state or toggle widget, which is the way this
- * should really be done. 1/22/88 - CDP.
- */
- - ChangeLabel(man_globals->label,
- - man_globals->section_name[man_globals->current_directory]);
- if (man_globals->both_shown == TRUE) {
- label_str = SHOW_BOTH;
- if (man_globals->dir_shown)
- --- 84,89 ----
- ***************
- *** 98,104 ****
- Widget dir = man_globals->manpagewidgets.directory;
-
- label_str = SHOW_ONE;
- ! XtPanedSetMinMax(dir,directory_height,directory_height);
- if (!man_globals->dir_shown) {
- XtUnmanageChild(manpage);
- XtManageChild(dir);
- --- 96,103 ----
- Widget dir = man_globals->manpagewidgets.directory;
-
- label_str = SHOW_ONE;
- ! XtPanedSetMinMax(dir, resources.directory_height,
- ! resources.directory_height);
- if (!man_globals->dir_shown) {
- XtUnmanageChild(manpage);
- XtManageChild(dir);
- ***************
- *** 116,121 ****
- --- 115,125 ----
- * is up so very little time is wasted in the extra popdown call later.
- */
- XtPopdown( XtParent(XtParent(w)) );
- + if (man_globals->dir_shown)
- + ChangeLabel(man_globals->label,
- + man_globals->section_name[man_globals->current_directory]);
- + else
- + ChangeLabel(man_globals->label, man_globals->manpage_title);
- ChangeLabel(man_globals->both_shown_button, label_str);
- /* if both are shown there is no need to switch between the two. */
- XtSetSensitive(man_globals->put_up_manpage,!man_globals->both_shown);
- ***************
- *** 156,161 ****
- --- 160,167 ----
-
- #define OFF_OF_TOP 25
-
- + /* ARGSUSED */
- +
- void
- PopUpMenu(w,junk,event)
- Widget w;
- ***************
- *** 188,193 ****
- --- 194,201 ----
- * Returns: none
- */
-
- + /* ARGSUSED */
- +
- void
- PopDown(w,junk,event)
- Widget w;
- ***************
- *** 226,232 ****
- else if ( !strcmp(Name(w),CANCEL) )
- file = NULL;
- else
- ! PrintWarning("Unknown widget");
-
- /* popdown the search widget */
-
- --- 234,240 ----
- else if ( !strcmp(Name(w),CANCEL) )
- file = NULL;
- else
- ! PrintError("Unknown widget, in Search Box.");
-
- /* popdown the search widget */
-
- ***************
- *** 254,270 ****
- InitManpage(man_globals,man_globals->manpagewidgets.manpage,file);
- fclose(file);
-
- ! if (!man_globals->both_shown) {
- XtUnmanageChild(man_globals->manpagewidgets.directory);
- XtManageChild(man_globals->manpagewidgets.manpage);
- - }
- -
- - XtSetSensitive(man_globals->both_shown_button,TRUE);
- - if (!man_globals->both_shown) {
- XtSetSensitive(man_globals->put_up_manpage,TRUE);
- ChangeLabel(man_globals->label,man_globals->manpage_title);
- man_globals->dir_shown = FALSE;
- }
- MakeLong( XtParent(man_globals->both_shown_button) );
- XtResetScrollByLine(man_globals->manpagewidgets.manpage);
- }
- --- 262,280 ----
- InitManpage(man_globals,man_globals->manpagewidgets.manpage,file);
- fclose(file);
-
- ! if (man_globals->both_shown) {
- ! ChangeLabel(man_globals->label,
- ! man_globals->section_name[man_globals->current_directory]);
- ! }
- ! else {
- XtUnmanageChild(man_globals->manpagewidgets.directory);
- XtManageChild(man_globals->manpagewidgets.manpage);
- XtSetSensitive(man_globals->put_up_manpage,TRUE);
- ChangeLabel(man_globals->label,man_globals->manpage_title);
- man_globals->dir_shown = FALSE;
- }
- +
- + XtSetSensitive(man_globals->both_shown_button,TRUE);
- MakeLong( XtParent(man_globals->both_shown_button) );
- XtResetScrollByLine(man_globals->manpagewidgets.manpage);
- }
- ***************
- *** 309,314 ****
- --- 319,326 ----
- * Returns: none.
- */
-
- + /* ARGSUSED */
- +
- void
- GotoManpage(w, global_pointer, event)
- Widget w;
- ***************
- *** 350,358 ****
- ManpageGlobals * man_globals = (ManpageGlobals *) global_pointer;
- XtListReturnStruct * ret_struct = (XtListReturnStruct *) ret_val;
-
- ! file = FindFilename(man_globals, ret_struct->string,
- ! man_globals->current_directory,
- ! &(manual[man_globals->current_directory].entries[ret_struct->index]));
- PutUpManpage(man_globals, file);
- }
-
- --- 362,369 ----
- ManpageGlobals * man_globals = (ManpageGlobals *) global_pointer;
- XtListReturnStruct * ret_struct = (XtListReturnStruct *) ret_val;
-
- ! file = FindFilename(man_globals,
- ! manual[man_globals->current_directory].entries[ret_struct->index]);
- PutUpManpage(man_globals, file);
- }
-
- ***************
- *** 378,391 ****
- int current_box;
-
- menu_struct = (MenuCallbackStruct *) pointer;
- -
- man_globals = (ManpageGlobals *) menu_struct->data;
-
- - /* The callback numbers go from 0 to n - 1 but I want from 1 to n */
- -
- number = menu_struct->number;
- - number++;
- -
- current_box = man_globals->current_directory;
-
- /* We have used this guy, pop down the menu. */
- --- 389,397 ----
- ***************
- *** 392,407 ****
-
- if (number != current_box) {
- /* This is the only one that we know has a parent. */
- ! parent = XtParent(man_globals->manpagewidgets.box[1]);
-
- MakeDirectoryBox(man_globals, parent,
- man_globals->manpagewidgets.box + number, number);
- XtUnmanageChild(man_globals->manpagewidgets.box[current_box]);
- XtManageChild(man_globals->manpagewidgets.box[number]);
- !
- man_globals->current_directory = number;
- }
- - ChangeLabel(man_globals->label, man_globals->section_name[number]);
-
- XtPopdown( XtParent(XtParent(w)) );
-
- --- 398,414 ----
-
- if (number != current_box) {
- /* This is the only one that we know has a parent. */
- ! parent = XtParent(man_globals->manpagewidgets.box[INITIAL_DIR]);
-
- MakeDirectoryBox(man_globals, parent,
- man_globals->manpagewidgets.box + number, number);
- XtUnmanageChild(man_globals->manpagewidgets.box[current_box]);
- XtManageChild(man_globals->manpagewidgets.box[number]);
- !
- ! XtListUnhighlight(man_globals->manpagewidgets.box[current_box]);
- ! ChangeLabel(man_globals->label, man_globals->section_name[number]);
- man_globals->current_directory = number;
- }
-
- XtPopdown( XtParent(XtParent(w)) );
-
- ***************
- *** 422,427 ****
- --- 429,436 ----
- * Returns: none
- */
-
- + /* ARGSUSED */
- +
- void
- SaveCallback(w,global_pointer,junk)
- Widget w;
- ***************
- *** 453,458 ****
- --- 462,469 ----
- * junk - the callback and closure date are not used.
- * Returns: none.
- */
- +
- + /* ARGSUSED */
-
- void
- ManpageButtonPress(w,global_pointer,event)
- *** /tmp/,RCSt1a17197 Fri Jan 6 18:56:47 1989
- --- clients/xman/main.c Fri Jan 6 18:42:11 1989
- **************
- *** 1,7 ****
- /*
- * xman - X window system manual page display program.
- *
- ! * $XConsortium: main.c,v 1.3 88/10/20 10:05:04 swick Exp $
- *
- * Copyright 1987, 1988 Massachusetts Institute of Technology
- *
- --- 1,7 ----
- /*
- * xman - X window system manual page display program.
- *
- ! * $XConsortium: main.c,v 1.4 89/01/06 18:42:08 kit Exp $
- *
- * Copyright 1987, 1988 Massachusetts Institute of Technology
- *
- ***************
- *** 20,26 ****
- */
-
- #if ( !defined(lint) && !defined(SABER))
- ! static char rcs_version[] = "$Athena: main.c,v 4.0 88/08/31 22:12:26 kit Exp $";
- #endif
-
- #include "globals.h"
- --- 20,26 ----
- */
-
- #if ( !defined(lint) && !defined(SABER))
- ! static char rcs_version[] = "$Athena: main.c,v 4.5 88/12/19 13:47:28 kit Exp $";
- #endif
-
- #include "globals.h"
- ***************
- *** 31,63 ****
-
- static void ArgError();
-
- ! /* XtOffset() hack for ibmrt BandAidCompiler */
-
- static XtResource my_resources[] = {
- {"manualFontNormal", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
- ! (Cardinal) &(fonts.normal), XtRString, MANPAGE_NORMAL},
- {"manualFontBold", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
- ! (Cardinal) &(fonts.bold), XtRString, MANPAGE_BOLD},
- {"manualFontItalic", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
- ! (Cardinal) &(fonts.italic), XtRString, MANPAGE_ITALIC},
- {"directoryFontNormal", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
- ! (Cardinal) &(fonts.directory), XtRString, DIRECTORY_NORMAL},
- {"bothShown", XtCBoolean, XtRBoolean, sizeof(Boolean),
- ! (Cardinal) &both_shown_initial, XtRString, "False"},
- {"directoryHeight", "DirectoryHeight", XtRInt, sizeof(int),
- ! (Cardinal) &directory_height, XtRString, "150"},
- {"topCursor", XtCCursor, XtRCursor, sizeof(Cursor),
- ! (Cardinal) &(cursors.top), XtRString, XMAN_CURSOR},
- {"helpCursor", XtCCursor, XtRCursor, sizeof(Cursor),
- ! (Cardinal) &(cursors.help), XtRString, HELP_CURSOR},
- {"manpageCursor", XtCCursor, XtRCursor, sizeof(Cursor),
- ! (Cardinal) &(cursors.manpage), XtRString, MANPAGE_CURSOR},
- {"searchEntryCursor", XtCCursor, XtRCursor, sizeof(Cursor),
- ! (Cardinal) &(cursors.search_entry), XtRString, SEARCH_ENTRY_CURSOR},
- {"helpFile", XtCFile, XtRString, sizeof(char *),
- ! (Cardinal) &(help_file), XtRString, HELPFILE},
- {"topBox", XtCBoolean, XtRBoolean, sizeof(Boolean),
- ! (Cardinal) &top_box_active, XtRString, "True"},
- };
-
- /*
- --- 31,63 ----
-
- static void ArgError();
-
- ! #define Offset(field) (XtOffset(Xman_Resources *, field))
-
- static XtResource my_resources[] = {
- {"manualFontNormal", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
- ! Offset(fonts.normal), XtRString, MANPAGE_NORMAL},
- {"manualFontBold", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
- ! Offset(fonts.bold), XtRString, MANPAGE_BOLD},
- {"manualFontItalic", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
- ! Offset(fonts.italic), XtRString, MANPAGE_ITALIC},
- {"directoryFontNormal", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
- ! Offset(fonts.directory), XtRString, DIRECTORY_NORMAL},
- {"bothShown", XtCBoolean, XtRBoolean, sizeof(Boolean),
- ! Offset(both_shown_initial), XtRString, "False"},
- {"directoryHeight", "DirectoryHeight", XtRInt, sizeof(int),
- ! Offset(directory_height), XtRString, "150"},
- {"topCursor", XtCCursor, XtRCursor, sizeof(Cursor),
- ! Offset(cursors.top), XtRString, XMAN_CURSOR},
- {"helpCursor", XtCCursor, XtRCursor, sizeof(Cursor),
- ! Offset(cursors.help), XtRString, HELP_CURSOR},
- {"manpageCursor", XtCCursor, XtRCursor, sizeof(Cursor),
- ! Offset(cursors.manpage), XtRString, MANPAGE_CURSOR},
- {"searchEntryCursor", XtCCursor, XtRCursor, sizeof(Cursor),
- ! Offset(cursors.search_entry), XtRString, SEARCH_ENTRY_CURSOR},
- {"helpFile", XtCFile, XtRString, sizeof(char *),
- ! Offset(help_file), XtRString, HELPFILE},
- {"topBox", XtCBoolean, XtRBoolean, sizeof(Boolean),
- ! Offset(top_box_active), XtRString, "True"},
- };
-
- /*
- ***************
- *** 85,134 ****
- char ** argv;
- int argc;
- {
- ! Widget top_menu;
- !
- ! top_menu = XtInitialize(TOPBOXNAME,"XMan",
- ! xman_options, XtNumber(xman_options),
- ! (unsigned int*) &argc,argv);
- if (argc != 1) {
- ArgError(argc, argv);
- exit(42);
- }
-
- ! XtGetApplicationResources( (Widget) top_menu, (caddr_t) NULL,
- my_resources, XtNumber(my_resources),
- NULL, (Cardinal) 0);
- - if (!fonts.normal)
- - XtError("failed to get the manualFontNormal font");
- - if (!fonts.bold)
- - fonts.bold = fonts.normal;
- - if (!fonts.italic)
- - fonts.italic = fonts.bold;
- - if (!fonts.directory)
- - fonts.directory = fonts.normal;
-
- #ifdef DEBUG
- printf("debugging mode\n");
- - XSynchronize( XtDisplay(top_menu), TRUE);
- #endif
-
- ! /* set default width and height. */
-
- ! default_width = DisplayWidth(XtDisplay(top_menu),
- ! XtDisplay(top_menu)->default_screen);
- ! default_width /= 2;
- ! default_height=DisplayHeight(XtDisplay(top_menu),
- ! XtDisplay(top_menu)->default_screen);
- default_height *= 3;
- default_height /= 4;
-
- sections = Man();
-
- ! MakeTopMenuWidget(top_menu);
- !
- ! if (top_box_active) {
- ! XtRealizeWidget(top_menu);
- ! AddCursor(top_menu,cursors.top);
- }
- else
- CreateManpage();
- --- 85,133 ----
- char ** argv;
- int argc;
- {
- ! initial_widget = XtInitialize(NULL, "XMan",
- ! xman_options, XtNumber(xman_options),
- ! (unsigned int*) &argc,argv);
- if (argc != 1) {
- ArgError(argc, argv);
- exit(42);
- }
-
- ! XtGetApplicationResources( initial_widget, (caddr_t) &resources,
- my_resources, XtNumber(my_resources),
- NULL, (Cardinal) 0);
-
- + if (!resources.fonts.normal)
- + PrintError("Failed to get the manualFontNormal font");
- + if (!resources.fonts.bold)
- + resources.fonts.bold = resources.fonts.normal;
- + if (!resources.fonts.italic)
- + resources.fonts.italic = resources.fonts.bold;
- + if (!resources.fonts.directory)
- + resources.fonts.directory = resources.fonts.normal;
- +
- #ifdef DEBUG
- printf("debugging mode\n");
- #endif
-
- ! /*
- ! * Set the default width and height.
- ! * I am not real happy with this method, but it will usually do something
- ! * reasonable, if not the "right" thing. It is not a real big issue since
- ! * it is easy to change the values with resources or command line options.
- ! * NOTE: if you are in a 100 dpi display you will lose.
- ! */
-
- ! default_width = DEFAULT_WIDTH;
- ! default_height=DisplayHeight(XtDisplay(initial_widget),
- ! XtDisplay(initial_widget)->default_screen);
- default_height *= 3;
- default_height /= 4;
-
- sections = Man();
-
- ! if (resources.top_box_active) {
- ! MakeTopMenuWidget();
- }
- else
- CreateManpage();
- ***************
- *** 138,144 ****
- * the screen so that if this user does not have a top box then when he
- * removes all his manual pages we can kill off the xman process.
- * To make things easier we will consider the top box a shown manual page
- ! * here, but since you cannot remove it, man_page_show only goes to zero when
- * no top box is present.
- */
-
- --- 137,143 ----
- * the screen so that if this user does not have a top box then when he
- * removes all his manual pages we can kill off the xman process.
- * To make things easier we will consider the top box a shown manual page
- ! * here, but since you cannot remove it, man_page_shown only goes to zero when
- * no top box is present.
- */
-
- ***************
- *** 174,180 ****
- int argc;
- {
- int i;
- - char * prog;
-
- static char **syntax, *syntax_def[] = {
- "-helpfile <filename>", "Specifies the helpfile to use.",
- --- 173,178 ----
- ***************
- *** 205,217 ****
- for (i = 1; i < argc ; i++)
- (void) printf("This argument is unknown to Xman: %s\n", argv[i]);
-
- - if ( (prog = rindex(argv[0], '/')) == NULL)
- - prog = argv[0];
- -
- (void) printf("\nKnown arguments are:\n");
-
- while ( *syntax != NULL ) {
- ! printf("%-20s - %s\n", syntax[0], syntax[1]);
- syntax += 2;
- }
- }
- --- 203,212 ----
- for (i = 1; i < argc ; i++)
- (void) printf("This argument is unknown to Xman: %s\n", argv[i]);
-
- (void) printf("\nKnown arguments are:\n");
-
- while ( *syntax != NULL ) {
- ! printf("%-30s - %s\n", syntax[0], syntax[1]);
- syntax += 2;
- }
- }
- *** /tmp/,RCSt1a17248 Fri Jan 6 18:57:03 1989
- --- clients/xman/search.c Fri Jan 6 18:42:29 1989
- ***************
- *** 1,7 ****
- /*
- * xman - X window system manual page display program.
- *
- ! * $XConsortium: search.c,v 1.2 88/09/04 20:27:33 swick Exp $
- * $oHeader: search.c,v 4.0 88/08/31 22:13:19 kit Exp $
- *
- * Copyright 1987, 1988 Massachusetts Institute of Technology
- --- 1,7 ----
- /*
- * xman - X window system manual page display program.
- *
- ! * $XConsortium: search.c,v 1.3 89/01/06 18:42:28 kit Exp $
- * $oHeader: search.c,v 4.0 88/08/31 22:13:19 kit Exp $
- *
- * Copyright 1987, 1988 Massachusetts Institute of Technology
- ***************
- *** 21,27 ****
- */
-
- #if ( !defined(lint) && !defined(SABER))
- ! static char rcs_version[] = "$Athena: search.c,v 4.0 88/08/31 22:13:19 kit Exp $";
- #endif
-
- #include "globals.h"
- --- 21,27 ----
- */
-
- #if ( !defined(lint) && !defined(SABER))
- ! static char rcs_version[] = "$Athena: search.c,v 4.7 89/01/06 15:59:02 kit Exp $";
- #endif
-
- #include "globals.h"
- ***************
- *** 35,41 ****
- #define SEARCHARGS 10
-
- FILE * DoManualSearch();
- ! struct entry * BEntrySearch();
-
- /* Function Name: MakeSearchWidget
- * Description: This Function Creates the Search Widget.
- --- 35,41 ----
- #define SEARCHARGS 10
-
- FILE * DoManualSearch();
- ! static int BEntrySearch();
-
- /* Function Name: MakeSearchWidget
- * Description: This Function Creates the Search Widget.
- ***************
- *** 66,72 ****
- popup_shell = XtCreatePopupShell(SEARCHNAME, transientShellWidgetClass,
- parent, arglist, num_args);
-
- ! box = XtCreateWidget("box",boxWidgetClass, popup_shell,NULL,0);
-
- num_args = 0;
- XtSetArg(arglist[num_args], XtNborderWidth, 0);
- --- 66,72 ----
- popup_shell = XtCreatePopupShell(SEARCHNAME, transientShellWidgetClass,
- parent, arglist, num_args);
-
- ! box = XtCreateWidget("box",boxWidgetClass, popup_shell,NULL, (Cardinal) 0);
-
- num_args = 0;
- XtSetArg(arglist[num_args], XtNborderWidth, 0);
- ***************
- *** 81,87 ****
- XtSetArg(arglist[num_args], XtNeditType, XttextEdit);
- num_args++;
-
- ! man_globals->search_string = INIT_SEARCH_STRING;
-
- XtSetArg(arglist[num_args], XtNstring, man_globals->search_string);
- num_args++;
- --- 81,87 ----
- XtSetArg(arglist[num_args], XtNeditType, XttextEdit);
- num_args++;
-
- ! strcpy(man_globals->search_string, INIT_SEARCH_STRING);
-
- XtSetArg(arglist[num_args], XtNstring, man_globals->search_string);
- num_args++;
- ***************
- *** 90,96 ****
-
- XtSetArg(arglist[num_args], XtNlength, SEARCH_STRING_LENGTH);
- num_args++;
- ! XtSetArg(arglist[num_args], XtNcursor, cursors.search_entry);
- num_args++;
-
- text = XtCreateWidget("textWidgetSearch",asciiStringWidgetClass,
- --- 90,96 ----
-
- XtSetArg(arglist[num_args], XtNlength, SEARCH_STRING_LENGTH);
- num_args++;
- ! XtSetArg(arglist[num_args], XtNcursor, resources.cursors.search_entry);
- num_args++;
-
- text = XtCreateWidget("textWidgetSearch",asciiStringWidgetClass,
- ***************
- *** 156,172 ****
-
- answer = XtMakeResizeRequest(text, width, height, &width, &height);
-
- ! switch(answer) {
- ! case XtGeometryYes:
- ! case XtGeometryNo:
- ! break;
- ! case XtGeometryAlmost:
- ! (void) XtMakeResizeRequest(text, width, height, &width, &height);
- ! }
-
- XtManageChild(box);
- XtRealizeWidget(popup_shell);
- ! AddCursor(popup_shell,cursors.search_entry);
- }
-
- /* Function Name: DoSearch
- --- 156,172 ----
-
- answer = XtMakeResizeRequest(text, width, height, &width, &height);
-
- ! switch(answer) {
- ! case XtGeometryYes:
- ! case XtGeometryNo:
- ! break;
- ! case XtGeometryAlmost:
- ! (void) XtMakeResizeRequest(text, width, height, &width, &height);
- ! }
-
- XtManageChild(box);
- XtRealizeWidget(popup_shell);
- ! AddCursor(popup_shell,resources.cursors.search_entry);
- }
-
- /* Function Name: DoSearch
- ***************
- *** 212,218 ****
-
- if (!strcmp(man_globals->search_string,"") ||
- (man_globals->search_string[0] == ' ')) {
- ! PrintWarning("You want me to search for what???");
- return(NULL);
- }
-
- --- 212,218 ----
-
- if (!strcmp(man_globals->search_string,"") ||
- (man_globals->search_string[0] == ' ')) {
- ! PrintWarning(man_globals, "You want me to search for what???");
- return(NULL);
- }
-
- ***************
- *** 228,235 ****
- strcpy(path,manpath);
-
- if (type == APROPOS) {
- ! sprintf(cmdbuf,"%s %s %s | %s > %s",APROPOSCOMMAND,path,
- ! man_globals->search_string,APROPOSFILTER,mantmp);
- sprintf(label,"Results of apropos search on: %s",
- man_globals->search_string);
-
- --- 228,234 ----
- strcpy(path,manpath);
-
- if (type == APROPOS) {
- ! sprintf(cmdbuf, APROPOSFILTER, path, man_globals->search_string, mantmp);
- sprintf(label,"Results of apropos search on: %s",
- man_globals->search_string);
-
- ***************
- *** 272,278 ****
- if (flag) {
- fclose(file);
- file = NULL;
- - /* PrintWarning(string_buf); */
- ChangeLabel(man_globals->label,string_buf);
- return(NULL);
- }
- --- 271,276 ----
- ***************
- *** 285,291 ****
- file = DoManualSearch(man_globals);
- if (file == NULL) {
- sprintf(string_buf,"No manual entry for %s.",man_globals->search_string);
- - /* PrintWarning(string_buf); */
- ChangeLabel(man_globals->label,string_buf);
- return(NULL);
- }
- --- 283,288 ----
- ***************
- *** 299,338 ****
- * Returns: the filename of the man page.
- */
-
- FILE *
- DoManualSearch(man_globals)
- ManpageGlobals *man_globals;
- {
- ! struct entry * entry = NULL;
- ! char *string, *name;
- ! int i;
- ! FILE * file;
-
- /* search current section first. */
-
- string = man_globals->search_string;
- i = man_globals->current_directory;
- ! entry = BEntrySearch(string, manual[i].entries, manual[i].nentries);
-
- /* search other sections. */
-
- ! if (entry == NULL) {
- i = -1; /* At the exit of the loop i needs to
- be the one we used. */
- do {
- i++;
- if (i == man_globals->current_directory) i++;
- ! entry = BEntrySearch(string, manual[i].entries, manual[i].nentries);
- ! } while ( (i < sections) && (entry == NULL) );
- }
- !
- ! if (entry == NULL)
- ! return(NULL);
- !
- ! name = CreateManpageName(entry->label);
- ! file = FindFilename(man_globals, name, i, entry);
- ! free(name);
- ! return(file);
- }
-
- /* Function Name: BEntrySearch
- --- 296,344 ----
- * Returns: the filename of the man page.
- */
-
- + #define NO_ENTRY -100
- +
- FILE *
- DoManualSearch(man_globals)
- ManpageGlobals *man_globals;
- {
- ! char *string;
- ! int e_num = NO_ENTRY;
- ! int i, initial_entry;
-
- /* search current section first. */
-
- string = man_globals->search_string;
- i = man_globals->current_directory;
- ! e_num = BEntrySearch(string, manual[i].entries, manual[i].nentries);
-
- /* search other sections. */
-
- ! if (e_num == NO_ENTRY) {
- i = -1; /* At the exit of the loop i needs to
- be the one we used. */
- do {
- i++;
- if (i == man_globals->current_directory) i++;
- ! e_num = BEntrySearch(string, manual[i].entries, manual[i].nentries);
- ! } while ( (i < sections) && (e_num == NO_ENTRY) );
- ! if (e_num == NO_ENTRY)
- ! return(NULL);
- ! /*
- ! * Manual page found in some other section, unhighlight the current one.
- ! */
- ! XtListUnhighlight(
- ! man_globals->manpagewidgets.box[man_globals->current_directory]);
- }
- ! else {
- ! /*
- ! * Highlight the element we are searching for if it is in the directory
- ! * listing currently being shown.
- ! */
- !
- ! XtListHighlight(man_globals->manpagewidgets.box[i], e_num);
- ! }
- ! return(FindFilename(man_globals, manual[i].entries[e_num]));
- }
-
- /* Function Name: BEntrySearch
- ***************
- *** 343,377 ****
- * Returns: a pointer to the entry found.
- */
-
- ! struct entry *
- BEntrySearch(string, first, number)
- char * string;
- ! struct entry * first;
- int number;
- {
- ! int check, cmp;
- ! char * c, label[BUFSIZ];
-
- while (TRUE) {
-
- ! if (number == 0)
- ! return(NULL); /* didn't find it. */
- !
- check = number/2;
-
- ! strcpy (label, first[check].label);
- ! c = index(label, '.');
- ! if (c != NULL);
- ! *c = '\0';
-
- ! cmp = strcmp(string, label);
-
- ! if ( cmp == 0 )
- ! return(&(first[check]));
- ! else if (cmp < 0)
- number = check;
- ! else /* cmp > 0 */ {
- ! first = &(first[check + 1]);
- number -= ( check + 1 );
- }
- }
- --- 349,391 ----
- * Returns: a pointer to the entry found.
- */
-
- ! static int
- BEntrySearch(string, first, number)
- char * string;
- ! char ** first;
- int number;
- {
- ! int check, cmp, len_cmp, global_number;
- ! char *head, *tail;
-
- + global_number = 0;
- while (TRUE) {
-
- ! if (number == 0) {
- ! return(NO_ENTRY); /* didn't find it. */
- ! }
- !
- check = number/2;
-
- ! head = rindex(first[ global_number + check ], '/');
- ! if (head == NULL)
- ! PrintError("index failure in BEntrySearch");
- ! head++;
-
- ! tail = rindex(head, '.');
- ! if (tail == NULL)
- ! PrintError("index failure in BEntrySearch");
-
- ! cmp = strncmp(string, head, (tail - head));
- ! len_cmp = strlen(string) - (int) (tail - head);
- !
- ! if ( cmp == 0 && len_cmp == 0) {
- ! return(global_number + check);
- ! }
- ! else if ( cmp < 0 || ((cmp == 0) && (len_cmp < 0)) )
- number = check;
- ! else /* cmp > 0 || ((cmp == 0) && (len_cmp > 0)) */ {
- ! global_number += (check + 1);
- number -= ( check + 1 );
- }
- }
- --
- Mike Wexler(wyse!mikew) Phone: (408)433-1000 x1330
- Moderator of comp.sources.x
-